<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;



Route::group('/v1',function (){
    //登入就行
    Route::group('', function (){
        //脚本
        Route::post('/script/ssr', 'InternationController/formatSSR');

        //行程单
        Route::post('/script/itinerary/qrcode', 'ItineraryController/uploadFile2QRCode');



        //用户
        Route::get('/user/list', 'UserController/getList');
        Route::get('/user/:id', 'UserController/getUserById')->model(\app\model\Users::class);
        Route::get('/userinfo', 'UserController/getUserInfo');

        //学习库
        Route::get('/study', 'StudyController/getList')->model(\app\model\City::class);

        //城市代码
        Route::get('/city/:id', 'CityController/getById')->model(\app\model\City::class);

        //配置库

        Route::get('/black/configuration/warehouse', 'BlackConfigurationWarehouseController/getList')->model(\app\model\City::class);

            Route::get('/debit_client/:id', 'DebitClientController/getById')->model(\app\model\DebitClient::class);
        Route::get('/debit_client', 'DebitClientController/getList');

        //流程
        Route::group('/operation', function (){


            //常用联系人
            Route::get('/passenger/frequently', 'OrderController/getFrequently');
            //识别证件信息
            Route::post('/passenger/papers', 'OrderController/IdentificationDocument');
            Route::group('', function (){
                //经停信息
                Route::get('/flight/stopover', 'BlackController/ff');
                //订座
                Route::post('/order/booking', 'OrderController/booking');
                //验价
                Route::post('/order/price', 'OrderController/validatePrice');
                //查儿童婴儿
                Route::post('/seat/chd/price', 'BlackController/getCHDPrice');
                Route::post('/seat/inft/price', 'BlackController/getINFTPrice');


                //查航班
                Route::get('/flight', 'BlackController/queryFlight');
                Route::post('/seat/price', 'BlackController/queryFlightSeatPrice');
                Route::get('/black/clear', 'BlackController/clear');

            })->middleware(\app\middleware\BlackConfigurationWarehouseStartMiddleware::class)
                ->middleware(\app\middleware\BlackConfigurationWarehouseEndMiddleware::class);




        });

        //订单
        Route::post('/operation/order', 'OrderController/add');
        Route::get('/air/order', 'OrderController/getList');



        //酒店王
        Route::post('/order/merge/good/redis', 'HotelKingController/mergeGood2redis');
        Route::post('/order/merge/connecting/redis', 'HotelKingController/mergeConnecting2redis');
        Route::post('/order/merge/reform/redis', 'HotelKingController/mergeReform2redis');
        Route::post('/order/download/redis', 'HotelKingController/downloadRedis');

        Route::post('/order/excel/merge/batch', 'HotelKingController/merge');
        Route::post('/order/merge/good', 'HotelKingController/mergeGood');
        Route::post('/order/merge/connecting', 'HotelKingController/mergeConnecting');
        Route::post('/order/merge/reform', 'HotelKingController/mergeReform');
        Route::post('/order/download', 'HotelKingController/download');

        //   SalesList 销售信息
        Route::post('/sales/batch', 'SalesListController/save2db');
        Route::post('/sales', 'SalesListController/add');
        Route::get('/sales', 'SalesListController/getList');


    })->middleware(\app\middleware\JwtAuth::class);

    //管理员
    Route::group('', function (){
        //用户
        Route::post('/user', 'UserController/addUser');
        Route::post('/user', 'UserController/addUser');
        Route::get('/user', 'UserController/getUser');

        //系统管理
        Route::put('/system/config/:id', 'SystemConfigController/update')->model(\app\model\SystemConfig::class);
        Route::get('/system/config', 'SystemConfigController/getList');

        //学习库
        Route::post('/study', 'StudyController/addOrUpdate');
        Route::delete('/study/:id', 'StudyController/delete')->model(\app\model\Study::class);



        Route::group('/admin',function (){
            //城市代码
            Route::get('/city', 'CityController/getList');
            Route::put('/city/batch', 'CityController/batchUpdate');
            Route::post('/city', 'CityController/add');

            //
            Route::get('/debit_client/:id', 'DebitClientController/getById')->model(\app\model\DebitClient::class);
            Route::delete('/debit_client/:id', 'DebitClientController/del')->model(\app\model\DebitClient::class);
            Route::get('/debit_client', 'DebitClientController/getList');
                Route::post('/debit_client', 'DebitClientController/add');
        });





    })->middleware(\app\middleware\JwtAuth::class,1);


    Route::post('/auth/login', 'UserController/login');
});